# use golang 1.12
FROM golang:1.13 as builder

# maintainer. Author's name and email.
MAINTAINER daolian "hyw1126@sina.com"

# Create app directory
RUN mkdir /app

# Add file to /app/
ADD . /app/

# work directory.
WORKDIR /app

# Run service on container startup
FROM alpine:latest

# in order to make docker stateless. Prepare a volumn
VOLUME /app/build/matter

# proxy
ENV GOPROXY=https://goproxy.cn

# prepare the config file
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o tank . \
    && cp -r /app/tank /app/build

# use 6010 as default.
EXPOSE 6010

# tank as execute file.
ENTRYPOINT ["/app/build/tank"]
